home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume4 / unaxcess / part1 next >
Encoding:
Internet Message Format  |  1986-11-30  |  51.5 KB

  1. Subject: UNaXcess (unix bulletin board) (1 of 3)
  2. Newsgroups: mod.sources
  3. Approved: jpn@panda.UUCP
  4.  
  5. Mod.sources:  Volume 4, Issue 65
  6. Submitted by: decvax!cwruecmp!ncoast!allbery
  7.  
  8. #! /bin/sh
  9. # This is a shell archive, meaning:
  10. # 1. Remove everything above the #! /bin/sh line.
  11. # 2. Save the resulting text in a file.
  12. # 3. Execute the file with /bin/sh (not csh) to create the files:
  13. #    M_README
  14. #    README
  15. #    Makefile
  16. #    Utilities
  17. #    dir.h
  18. #    sys.h
  19. #    ua.h
  20. #    user.h
  21. # This archive created: Sat Apr 12 10:01:29 1986
  22. export PATH; PATH=/bin:$PATH
  23. echo shar: extracting "'M_README'" '(2944 characters)'
  24. if test -f 'M_README'
  25. then
  26.     echo shar: will not over-write existing file "'M_README'"
  27. else
  28. cat << \SHAR_EOF > 'M_README'
  29.                       ***  Moderator's Readme ***
  30.  
  31. Since this submission's README did not include a description of the program,
  32. I decided to add one myself.  This program is a UNIX based bulletin board
  33. system, much like the ones you find running stand-alone on micros.  It
  34. allows for bulletins, and several different conferences, and file
  35. up/down load (within the bulletin board system) - Xmodem and kermit transfers
  36. are supported if you already have these programs.  Priveleged users can
  37. be given access to the shell (or some other program - this is configurable).
  38. There are actually 5 normal levels of privelege available.  (six if
  39. you include the "new" level).  Users have passwords, and the passwords
  40. are kept encrypted - similar to the /etc/passwd format.
  41.  
  42. UNaXcess can be set up as an account's login shell, so that outside users
  43. can use UNaXcess without having an account.  Users with accounts can also
  44. access the board by running the "ua" main program.  UNaXcess must be
  45. configured by setting aside a user-id (really an account name) for use by
  46. this system - many of the program are configured as set-uid to this account.
  47. The home directory for this account is the directory tree where all files
  48. and conferences are stored.
  49.  
  50. UNaXcess comes with a script to install the system much like the "Rn"
  51. config script, but it expects to be run as root, and may muck around
  52. with the password file.  I did not actually run this script (I don't
  53. currently have root privledge - and I hate running things as root unless
  54. I am sure about what they do anyway!), so I did all the things the
  55. script would have done, but by hand - it looks quite reasonable.
  56. One question in the install script confused me at first: "What is the
  57. login name of the user who can't log directly into UNaXcess?"  This is
  58. the name of the account that is set aside for remote UNaXcess logins -
  59. users logging in this way will be asked for an UNaXcess account name
  60. to use.
  61.  
  62. Oh, I didn't change my password file either - I made a minor change
  63. to param.c [#ifdef JPNHACK] to compile in the base directory instead
  64. of looking it up in the password file, I put all the programs into
  65. a special directory instead of /bin, I made all the setuid programs
  66. setuid to ME, and I allow access via the following shell script:
  67.  
  68. #! /bin/sh
  69. PATH=/c/jpn/ua/bin:$PATH
  70. export PATH
  71. exec /c/jpn/ua/bin/ua $*
  72.  
  73. Of course, this is not necessary if you feel comfortable adding a
  74. new account to your system for UNaXcess.
  75.  
  76. UNaXcess came with code to run on BSD systems if compiled with the -DBSD
  77. flag.  I spend some time to actually make BSD work - hopefully I did not
  78. break the USG version in the process.  I also suggest that you read the
  79. README file (Notes for installing) twice - I found some of the details
  80. to be a bit subtle.
  81.  
  82. Good Luck!
  83.  
  84. John P. Nelson, Moderator, mod.sources
  85. (decvax!genrad!panda!jpn  seismo!harvard!wjh12!panda!jpn)
  86. Send source code to panda!sources, requests to panda!sources-request
  87. SHAR_EOF
  88. if test 2944 -ne "`wc -c < 'M_README'`"
  89. then
  90.     echo shar: error transmitting "'M_README'" '(should have been 2944 characters)'
  91. fi
  92. fi
  93. echo shar: extracting "'README'" '(7233 characters)'
  94. if test -f 'README'
  95. then
  96.     echo shar: will not over-write existing file "'README'"
  97. else
  98. cat << \SHAR_EOF > 'README'
  99. UNaXcess Version 0.04.03            Wednesday, March 5, 1986 - 9:00 PM
  100.  
  101.           Supplemental notes for installing UNaXcess
  102.  
  103.  
  104. This directory contains the UNaXcess Distribution.  There is no User's Guide
  105. at present, and it is only known to work on V7 and AT&T System III.  Berkeley
  106. Unix should work, but System V users will have to change uwho.c to reflect
  107. the format of /etc/inittab under System V.
  108.  
  109. The shar file should have created a number of files in this directory, and
  110. a subdirectory called ``Utilities'' containing even more files.  Inspect the
  111. Makefile (it SHOULD work as it is on any system, but you never know), then
  112. type ``make SYSTEM=system all'', where system is BSD, SYS3, or V7.  Xenix
  113. people should compile with SYSTEM=V7, as should people running BSD2.9 or
  114. BSD4.1.  System V people should compile with -DSYS3 (after making the changes
  115. to uwho.c described above).  (Xenixers will have to define Index and RIndex
  116. to be strchr and strrchr also, if they are running 3.0 or later.)  Note that
  117. this program uses _doprnt() in the up/download module; a -DUSE_PRINT is
  118. defined in the Makefile, since Plexus sys3 systems (at least) use a different
  119. function for formatted output, and Plexus _print takes different arguments.
  120. Remove -DUSE_PRINT from the CFLAGS in the Makefile if your system uses
  121. _doprnt().
  122.  
  123. To install UNaXcess, type ``sh Utilities/install.sh'' while in the source
  124. directory. You will be asked various questions and be placed in the editor to
  125. compose a bulletin.
  126.  
  127. After installation, you should edit the NewMessage file as specified by the
  128. installation script.  It should say anything you want new users to know before
  129. registering as UNaXcess users.
  130.  
  131. You should also run UnaXcess as sysop and type ``user new'' to edit the new-
  132. user setup.  The parameter to be set is the access level granted.  As
  133. distribu- ted, this is USER access level.  For business applications, this
  134. should be SYSTEM (allowing shell access).  For certain applications, it should
  135. be set to GUEST (users can only post to the GUEST conference).  Note that
  136. there are 6 access levels:
  137.  
  138.     NONE        - de-activated logins or un-validated logins
  139.     MAKEUSER    - runs the user maker before entering
  140.     GUEST        - can read anything, only add to GUEST
  141.     FILES        - can access the File Section
  142.     SYSTEM        - can use the C command (shell access), also
  143.               can use a system editor to edit messages
  144.     FAIRWITNESS    - all but a sysop.  The only limitation is that
  145.               only the Sysop (who is a fairwitness) can make
  146.               or break other fairwitnesses.
  147.  
  148. -----------------------
  149. Some notes:
  150.  
  151. The configuration file is stored in the home directory of the UNaXcess system
  152. and is named ``ua-config''.  It contains lines of the format:
  153.  
  154.                 variable    value
  155.  
  156. The defaults are contained in param.c, not that you should change them (that's
  157. what the config file is for).  UNKNOWN VARIABLES WILL CAUSE UNAXCESS NOT TO
  158. RUN.  The variables are:
  159.  
  160.     readonly    boolean    Indicates whether Read-Only conferences are
  161.                 valid.  Read-Only conferences begin with
  162.                 the characters ``r-''.
  163.  
  164.     x-rated        boolean    Indicates whether X-Rated (restricted)
  165.                 conferences are valid.  X-Rated conferences
  166.                 begin with the characters ``x-''.
  167.  
  168.     editor        string    The path of the editor to use in creating
  169.                 messages.  The editor ``ua-edit'' is the
  170.                 built-in editor.  This editor is used only
  171.                 if the user has SYSTEM access or greater;
  172.                 otherwise, the built-in editor is used.
  173.  
  174.     shell        string    The path of the shell to use when the C
  175.                 command is invoked.  The C command is not
  176.                 valid for users whose access is less than
  177.                 SYSTEM level.  (Note:  there is no reason
  178.                 that this must be a shell.  The original
  179.                 version of the File Section was a separate
  180.                 program accessed by the C command.)
  181.  
  182.     read-env    boolean    Indicates whether the user's environment
  183.                 should be read to indicate the shell and
  184.                 editor.
  185.  
  186.     bbs-user    string    UNaXcess will permit a user whose Unix login
  187.                 name is the same as his UA login name to log
  188.                 in from the shell without specifying his name
  189.                 or password.  The ``bbs-user'' is exempt from
  190.                 this; it is intended to prevent breaches in
  191.                 security by invoking a shell (C command) and
  192.                 running ua from the shell.
  193.  
  194.     time-limit    number    This is the time limit for UNaXcess in minutes.
  195.                 If this is zero, no time-out occurs.  A warning
  196.                 is given five minutes before a logout; if the
  197.                 user is in the shell or editor when his time
  198.                 runs out, exiting the shell or editor will
  199.                 log him out.
  200.  
  201.     sysop        string    The name of the UNaXcess sysop is configurable.
  202.                 Special-purpose systems may indicate a more
  203.                 descriptive name (i.e. DUNGEON MASTER for a
  204.                 fantasy gaming BBS).
  205.  
  206.     private-msgs    boolean    Indicates whether private messages may be
  207.                 created.
  208.  
  209.     logging        boolean    Indicates whether a session log should be kept
  210.                 in Logfile.  This allows you to track security
  211.                 problems, people who misuse the system, or
  212.                 (heaven forbid) bugs.  However, the log gets
  213.                 big rather quickly, so you may wish to leave
  214.                 this off.
  215.  
  216.     banner        string    This string contains the name of a file whose
  217.                 contents are printed when a user runs UNaXcess,
  218.                 before the login message.  If the string is
  219.                 empty, a default banner is used.
  220.  
  221.     login-msg    string    This string is printed as the login prompt.
  222.                 If it is empty, a default string is used.
  223.                 You might want to change this if you disallow
  224.                 GUEST or NEW logins, or change their names.
  225.  
  226.     pauses        number    This is 2 for no pauses, 1 for user-specified
  227.                 pausing, and 0 for forced pausing.  A cheap
  228.                 built-in pager is used.
  229.  
  230.     login-tries    number    If this is not 0, it specifies the number of
  231.                 login attempts permitted before UNaXcess exits.
  232.  
  233.     ascii-upload    string    These are the command strings to be passed to
  234.     ascii-download        /bin/sh via system() to perform the specified
  235.     xmodem-upload        action.  The defualts are:  a cat string for
  236.     xmodem-download        ascii, umodem -[sr]b for XModem, and C-Kermit
  237.     kermit-upload        command strings for Kermit.  The string ``%s''
  238.     kermit-download        will be replaced with the file's path; if no
  239.                 ``%s'' is specified, the pathname will be
  240.                 appended to the command, preceded by a space.
  241.                 If the string is empty, UNaXcess will assume
  242.                 that no capacity exists for the action.
  243.  
  244.  
  245. A string is specified in double quotes:  "/bin/sh".  Actually, the quotes can
  246. be left off, but in this case the string cannot contain spaces or tabs.  A
  247. boolean is indicated as YES or NO (Y or N will do, and case doesn't matter).
  248. A number is simply a number, but is limited to 0-255.  Strings may contain
  249. escapes (\n \r \t \b \f \e \nnn \a) (\a is bell).  Comments are indicated by
  250. #; they do NOT have to be at the beginning of a line.
  251.  
  252. UNaXcess depends on being setuid to its owner, not only for permissions in
  253. the BBS, but also to insure that the home directory (containing the message
  254. database and config file) can be located.
  255.  
  256. UNaXcess is Copyright (C) 1986 by Brandon S. Allbery.  Permission is hereby
  257. granted to copy and freely distribute this code, Version 0.4.3 and derivatives
  258. ONLY.  Versions 1.0.0 and later are NOT permitted to be copied or distributed.
  259. You may charge only a reasonable handling/copying fee for distribution of this
  260. code, you may NOT sell it.
  261.  
  262. --Brandon Allbery
  263. SHAR_EOF
  264. if test 7233 -ne "`wc -c < 'README'`"
  265. then
  266.     echo shar: error transmitting "'README'" '(should have been 7233 characters)'
  267. fi
  268. fi
  269. echo shar: extracting "'Makefile'" '(2157 characters)'
  270. if test -f 'Makefile'
  271. then
  272.     echo shar: will not over-write existing file "'Makefile'"
  273. else
  274. cat << \SHAR_EOF > 'Makefile'
  275. #
  276. # %W% %E% %U% ncoast!bsa %Z%
  277. # %Z% Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved %Z%
  278. #
  279.  
  280. # ``make SYSTEM=SYS3 all''
  281. # ``make SYSTEM=BSD all''
  282. # ``make SYSTEM=V7 all''
  283.  
  284. SHELL = /bin/sh
  285. # make on sys3 is not very nice when it comes to standard shell interfaces...
  286.  
  287. # -DUSE_PRINT is for Plexus sys 3 - the default uses _doprnt for formatting.
  288. #CFLAGS = -D$(SYSTEM) -O -DUSE_PRINT
  289. CFLAGS = -D$(SYSTEM) -O
  290.  
  291. all: ua uwho udate mkconf mvmsg uanews
  292.  
  293. uwho: Utilities/uwho
  294. udate: Utilities/udate
  295. mkconf: Utilities/mkconf
  296. mvmsg: Utilities/mvmsg
  297. uanews: Utilities/uanews
  298.  
  299. ua: ua.o msg.o conf.o date.o bull.o sys.o user.o dir.o param.o udl.o
  300.     cc -o ua ua.o msg.o conf.o date.o bull.o sys.o user.o dir.o param.o udl.o
  301.  
  302. ua.o msg.o conf.o date.o bull.o sys.o user.o dir.o param.o udl.o: ua.h user.h dir.h sys.h
  303.  
  304. Utilities/mkconf: Utilities/mkconf.o
  305.     cc Utilities/mkconf.o -o Utilities/mkconf
  306.  
  307. Utilities/udate: Utilities/udate.o date.o
  308.     cc Utilities/udate.o date.o -o Utilities/udate
  309.  
  310. Utilities/uwho: Utilities/uwho.o
  311.     cc -o Utilities/uwho Utilities/uwho.o
  312.  
  313. Utilities/mvmsg: Utilities/mvmsg.o
  314.     cc -o Utilities/mvmsg Utilities/mvmsg.o
  315.  
  316. Utilities/uanews: Utilities/uanews.o
  317.     cc -o Utilities/uanews Utilities/uanews.o
  318.  
  319. Utilities/mkconf.o: Utilities/mkconf.c
  320.     ${CC} ${CFLAGS} -c Utilities/mkconf.c
  321.     mv mkconf.o Utilities/mkconf.o
  322.  
  323. Utilities/udate.o: Utilities/udate.c
  324.     ${CC} ${CFLAGS} -c Utilities/udate.c
  325.     mv udate.o Utilities/udate.o
  326.  
  327. Utilities/uwho.o: Utilities/uwho.c
  328.     ${CC} ${CFLAGS} -c Utilities/uwho.c
  329.     mv uwho.o Utilities/uwho.o
  330.  
  331. Utilities/mvmsg.o: Utilities/mvmsg.c
  332.     ${CC} ${CFLAGS} -c Utilities/mvmsg.c
  333.     mv mvmsg.o Utilities/mvmsg.o
  334.  
  335. Utilities/uanews.o: Utilities/uanews.c
  336.     ${CC} ${CFLAGS} -c Utilities/uanews.c
  337.     mv uanews.o Utilities/uanews.o
  338.  
  339. clean:
  340.     rm -f ua Utilities/uwho Utilities/udate Utilities/upost \
  341.         Utilities/mvmsg Utilities/uanews \
  342.         Utilities/mkconf Utilities/umotd *.o Utilities/*.o tags core \
  343.         shar?
  344.  
  345. tags:
  346.     ctags *.[ch] Utilities/*.c
  347.  
  348. shar:
  349.     shar -dv ua.c date.c bull.c sys.c user.c param.c dir.c > shar1
  350.     shar -dv msg.c conf.c ua.h user.h dir.h sys.h README > shar2
  351.     shar -dv udl.c Makefile Utilities/*.c Utilities/*.sh > shar3
  352. SHAR_EOF
  353. if test 2157 -ne "`wc -c < 'Makefile'`"
  354. then
  355.     echo shar: error transmitting "'Makefile'" '(should have been 2157 characters)'
  356. fi
  357. fi
  358. if test ! -d 'Utilities'
  359. then
  360.     echo shar: creating directory "'Utilities'"
  361.     mkdir 'Utilities'
  362. fi
  363. echo shar: extracting "'Utilities/mkconf.c'" '(1243 characters)'
  364. if test -f 'Utilities/mkconf.c'
  365. then
  366.     echo shar: will not over-write existing file "'Utilities/mkconf.c'"
  367. else
  368. cat << \SHAR_EOF > 'Utilities/mkconf.c'
  369. /*
  370.  * %W% %E% %U% ncoast!bsa %Z%
  371.  * %Z% Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved %Z%
  372.  */
  373.  
  374. #ifndef lint
  375. static char _SccsId[] = "%W% %E% %U% ncoast!bsa %Z%";
  376. static char _CopyRt[] = "%Z% Copyright (C) 1985 by Brandon S. Allbery %Z%";
  377. #endif  lint
  378.  
  379. /* this version that execs "mkdir" by jpn 4/12/86 */
  380. main(argc, argv)
  381. int argc;
  382. char **argv;
  383.     {
  384.     setuid(geteuid());
  385.     umask(022);
  386.     execvp("mkdir", argv);
  387.     }
  388.  
  389. #if 0
  390. /* I considered the original supplied version to be too dangerous and
  391. ** actually quite unnecessary.  This program just does a "mkdir", so
  392. ** the my version just exec's "mkdir"!
  393. **
  394. ** I HATE having setuid to root programs on my system that were not supplied
  395. ** as part of the system!                 - jpn 4/12/86
  396. */
  397. #include <sys/types.h>
  398. #include <sys/stat.h>
  399. #include <sys/dir.h>
  400.  
  401. char line[256];
  402.  
  403. #ifdef SYS3
  404. #define RIndex        strrchr
  405. #else
  406. #define RIndex        rindex
  407. #endif SYS3
  408.  
  409. char *RIndex();
  410.  
  411. main(argc, argv)
  412.     char **argv;
  413.     {
  414.     if (argc != 3)
  415.     exit(1);
  416.     mknod(argv[1], S_IFDIR|0755, 0);
  417.     chown(argv[1], atoi(argv[2]), 50);
  418.     sprintf(line, "%s/.", argv[1]);
  419.     link(argv[1], line);
  420.     *RIndex(argv[1], '/') = '\0';
  421.     strcat(line, ".");
  422.     link(argv[1], line);
  423.     }
  424. #endif
  425. SHAR_EOF
  426. if test 1243 -ne "`wc -c < 'Utilities/mkconf.c'`"
  427. then
  428.     echo shar: error transmitting "'Utilities/mkconf.c'" '(should have been 1243 characters)'
  429. fi
  430. fi
  431. echo shar: extracting "'Utilities/mvmsg.c'" '(4108 characters)'
  432. if test -f 'Utilities/mvmsg.c'
  433. then
  434.     echo shar: will not over-write existing file "'Utilities/mvmsg.c'"
  435. else
  436. cat << \SHAR_EOF > 'Utilities/mvmsg.c'
  437. /*
  438.  * %W% %E% %U% ncoast!bsa %Z%
  439.  * %Z% Copyright (C) 1985 by Brandon S. Allbery, All Rights Reserved %Z%
  440.  */
  441.  
  442. #ifndef lint
  443. static char _SccsId[] = "%W% %E% %U% ncoast!bsa %Z%";
  444. static char _CopyRt[] = "%Z% Copyright (C) 1985 by Brandon S. Allbery %Z%";
  445. #endif  lint
  446.  
  447. #include <stdio.h>
  448. #include <pwd.h>
  449. #include <sys/types.h>
  450. #include <sys/stat.h>
  451.  
  452. #ifdef SYS3
  453. #define Index        strchr
  454. #define RIndex        strrchr
  455. #else  SYS3
  456. #define Index        index
  457. #define RIndex        rindex
  458. #endif
  459.  
  460. extern long atol();
  461. extern char *Index();
  462. extern struct passwd *getpwuid();
  463.  
  464. main(argc, argv)
  465. char **argv; {
  466.     char msgdir[256], conf[33];
  467.     long msg;
  468.     char *cp, *dp;
  469.     int status;
  470.  
  471.     if (argc != 3) {
  472.         fprintf(stderr, "Usage: mvmsg conf[/n] conf\n");
  473.         exit(1);
  474.     }
  475.     strcpy(msgdir, getpwuid(geteuid())->pw_dir);
  476.     strcat(msgdir, "/msgdir");
  477.     for (cp = argv[1], dp = conf; *cp != '/' && *cp != '\0'; cp++, dp++)
  478.         *dp = *cp;
  479.     *dp = '\0';
  480.     if (*cp == '\0') {
  481.         FILE *fp;
  482.         char tmp[512];
  483.         long limit, cnt;
  484.         
  485.         sprintf(tmp, "%s/%s/himsg", msgdir, conf);
  486.         if ((fp = fopen(tmp, "r")) == (FILE *) 0) {
  487.             fprintf(stderr, "Conference %s: missing himsg...\n", conf);
  488.             exit(7);
  489.         }
  490.         fgets(tmp, sizeof tmp, fp);
  491.         fclose(fp);
  492.         if ((limit = atol(tmp)) <= 0) {
  493.             fprintf(stderr, "Conference %s: invalid himsg...\n", conf);
  494.             exit(8);
  495.         }
  496.         for (cnt = 0, msg = 1; msg <= limit; msg++)
  497.             if ((status = mvmsg(msgdir, conf, msg, argv[2])) > 0)
  498.                 exit(status);
  499.             else if (status == 0)
  500.                 cnt++;
  501.         printf("%ld messages moved from %s to %s.\n", cnt, conf, argv[2]);
  502.         sprintf(tmp, "%s/%s/himsg", msgdir, conf);
  503.         if (unlink(tmp) != 0)
  504.             exit(12);
  505.         sprintf(tmp, "%s/%s", msgdir, conf);
  506.         if (rmdir(tmp) != 0)
  507.             exit(13);
  508.         exit(cnt == 0? 9: 0);
  509.     }
  510.     msg = atol(++cp);
  511.     if (Index(argv[2], '/') != (char *) 0) {
  512.         fprintf(stderr, "Usage: mvmsg conf[/n] conf\n");
  513.         exit(1);
  514.     }
  515.     if ((status = mvmsg(msgdir, conf, msg, argv[2])) == -1)
  516.         fprintf(stderr, "Couldn't read %s/%ld\n", conf, msg);
  517.     exit(status);
  518. }
  519.  
  520. mvmsg(base, conf, msg, dest)
  521. char *base, *conf, *dest;
  522. long msg; {
  523.     char path[512], temp[512];
  524.     long newmsg;
  525.     FILE *ifp, *ofp;
  526.     struct stat sbuf;
  527.     
  528.     sprintf(path, "%s/%s/%ld", base, conf, msg);
  529.     if (stat(path, &sbuf) < 0)
  530.         return -1;    /* likely to be common... */
  531.     sprintf(path, "%s/%s/himsg", base, dest);
  532.     if ((ifp = fopen(path, "r")) == (FILE *) 0) {
  533.         fprintf(stderr, "Conference %s: missing himsg...\n", dest);
  534.         return 2;
  535.     }
  536.     fgets(temp, sizeof temp, ifp);
  537.     fclose(ifp);
  538.     if ((newmsg = atol(temp)) <= 0) {
  539.         fprintf(stderr, "Conference %s: invalid himsg...\n", dest);
  540.         return 2;
  541.     }
  542.     newmsg++;
  543.     sprintf(path, "%s/%s/%ld", base, conf, msg);
  544.     if ((ifp = fopen(path, "r")) == (FILE *) 0) {
  545.         fprintf(stderr, "Conference %s: check permissions on message %ld\n", conf, msg);
  546.         return 3;
  547.     }
  548.     sprintf(path, "%s/%s/%ld", base, dest, newmsg);
  549.     if (stat(path, &sbuf) == 0) {
  550.         fprintf(stderr, "Conference %s: corrupted (himsg incorrect)\n", dest);
  551.         fclose(ifp);
  552.         return 4;
  553.     }
  554.     if ((ofp = fopen(path, "w")) == (FILE *) 0) {
  555.         fprintf(stderr, "Conference %s: check permissions (can't create message)\n", dest);
  556.         fclose(ifp);
  557.         return 5;
  558.     }
  559.     while (fgets(temp, sizeof temp, ifp) != (char *) 0) {
  560.         fputs(temp, ofp);
  561.         if (ferror(ofp)) {
  562.             fprintf(stderr, "Write error on %s/%ld\n", dest, newmsg);
  563.             exit(5);    /* fatal! */
  564.         }
  565.     }
  566.     if (ferror(ifp)) {
  567.         fprintf(stderr, "Read error on %s/%ld\n", conf, msg);
  568.         fclose(ifp);
  569.         fclose(ofp);
  570.         return 6;
  571.     }
  572.     fclose(ifp);
  573.     fclose(ofp);
  574.     sprintf(path, "%s/%s/himsg", base, dest);
  575.     if ((ifp = fopen(path, "w")) == (FILE *) 0) {
  576.         fprintf(stderr, "Conference %s: check permissions on himsg...\n", dest);
  577.         return 2;
  578.     }
  579.     fprintf(ifp, "%ld\n", newmsg);
  580.     fclose(ifp);
  581.     sprintf(path, "%s/%s/%ld", base, conf, msg);
  582.     if (unlink(path) < 0)
  583.         return 10;
  584.     return 0;
  585. }
  586.  
  587. #ifndef BSD4
  588.  
  589. /* Berkeley has a rmdir() system call!  Heaven!  But I'm on sys3 (boo hiss) */
  590.  
  591. rmdir(path)
  592. char *path; {
  593.     int pid, status;
  594.     
  595.     switch (pid = fork()) {
  596.         case -1:
  597.             return -1;
  598.         case 0:
  599.             execl("/bin/rmdir", "rmdir", path, 0);
  600.             exit(-100);
  601.         default:
  602.             while (wait(&status) != pid)
  603.                 ;
  604.             return status;
  605.     }
  606. }
  607.  
  608. #endif BSD4
  609. SHAR_EOF
  610. if test 4108 -ne "`wc -c < 'Utilities/mvmsg.c'`"
  611. then
  612.     echo shar: error transmitting "'Utilities/mvmsg.c'" '(should have been 4108 characters)'
  613. fi
  614. fi
  615. echo shar: extracting "'Utilities/uanews.c'" '(5804 characters)'
  616. if test -f 'Utilities/uanews.c'
  617. then
  618.     echo shar: will not over-write existing file "'Utilities/uanews.c'"
  619. else
  620. cat << \SHAR_EOF > 'Utilities/uanews.c'
  621. /*
  622.  * %W% %E% %U% ncoast!bsa %Z%
  623.  * %Z% Copyright (C) 1985 by Brandon S. Allbery, All Rights Reserved %Z%
  624.  */
  625.  
  626. #ifndef lint
  627. static char _SccsId[] = "%W% %E% %U% ncoast!bsa %Z%";
  628. static char _CopyRt[] = "%Z% Copyright (C) 1985 by Brandon S. Allbery %Z%";
  629. #endif  lint
  630.  
  631. #include <stdio.h>
  632. #include <pwd.h>
  633. #include <sys/types.h>
  634. #include <sys/stat.h>
  635.  
  636. #define NEWSRC        "%newslink"    /* simplified .newsrc */
  637. #define ACTIVE        "/usr/lib/news/active"
  638. #define NEWSDIR        "/usr/spool/news"
  639. /* no need to define special if you're 2.10.2; we can intuit the new active file */
  640.  
  641. #ifdef SYS3
  642. #define Index        strchr
  643. #define RIndex        strrchr
  644. #else  SYS3
  645. #define Index        index
  646. #define RIndex        rindex
  647. #endif
  648.  
  649. extern long atol();
  650. extern char *Index();
  651. extern struct passwd *getpwuid();
  652.  
  653. extern int errno;
  654.  
  655. main(argc, argv)
  656. char **argv; {
  657.     char msgdir[256], conf[33];
  658.     long msg;
  659.     char *cp, *dp;
  660.     int status;
  661.  
  662.     if (argc != 3) {
  663.         fprintf(stderr, "Usage: uanews newsgroup[/article] conf\n");
  664.         exit(1);
  665.     }
  666.     strcpy(msgdir, getpwuid(geteuid())->pw_dir);
  667.     strcat(msgdir, "/msgdir");
  668.     for (cp = argv[1], dp = conf; *cp != '/' && *cp != '\0'; cp++, dp++)
  669.         *dp = *cp;
  670.     *dp = '\0';
  671.     if (*cp == '\0') {
  672.         FILE *fp;
  673.         char tmp[512], ng[512];
  674.         long limit, cnt, minact;
  675.         
  676.         if ((fp = fopen(ACTIVE, "r")) == (FILE *) 0) {
  677.             fprintf(stderr, "Not a Usenet site (no active file)...\n", conf);
  678.             exit(7);
  679.         }
  680.         while (fgets(tmp, sizeof tmp, fp) != NULL) {
  681.             if (sscanf(tmp, "%s %ld %ld", ng, &limit, &minact) == 2)
  682.                 minact = 1;    /* < 2.10.2 */
  683.             if (strcmp(ng, conf) == 0)
  684.                 break;
  685.         }
  686.         fclose(fp);
  687.         if (strcmp(ng, conf) != 0) {
  688.             fprintf(stderr, "I can't find a newsgroup called %s.\n", conf);
  689.             exit(13);
  690.         }
  691.         if (minact == limit) {
  692.             fprintf(stderr, "Newsgroup %s is empty.\n", conf);
  693.             exit(14);
  694.         }
  695.         sprintf(tmp, "%s/%s/%s", msgdir, argv[2], NEWSRC);
  696.         if ((fp = fopen(tmp, "r")) != (FILE *) 0) {
  697.             char tmp2[512];
  698.  
  699.             while (fgets(tmp, sizeof tmp, fp) != (char *) 0) {
  700.                 sscanf(tmp, "%[^:]: %ld", tmp2, &cnt);
  701.                 if (strcmp(tmp2, ng) == 0)
  702.                     break;
  703.             }
  704.             if (strcmp(tmp2, ng) == 0)
  705.                 minact = cnt + 1;
  706.             fclose(fp);
  707.         }
  708.         printf("News articles %d to %d\n", minact, limit);
  709.         for (cnt = 0, msg = minact; msg <= limit; msg++) {
  710.             if ((status = copynews(msgdir, conf, msg, argv[2])) > 0)
  711.                 exit(status);
  712.             else if (status == 0)
  713.                 cnt++;
  714.         }
  715.         printf("%ld news articles posted from %s to %s.\n", cnt, conf, argv[2]);
  716.         exit(cnt == 0? 9: 0);
  717.     }
  718.     msg = atol(++cp);
  719.     if (Index(argv[2], '/') != (char *) 0) {
  720.         fprintf(stderr, "Usage: uanews newsgroup[/article] conf\n");
  721.         exit(1);
  722.     }
  723.     if ((status = copynews(msgdir, conf, msg, argv[2])) == -1)
  724.         fprintf(stderr, "Couldn't read article %ld of %s\n", msg, conf);
  725.     exit(status);
  726. }
  727.  
  728. copynews(base, ng, art, dest)
  729. char *base, *ng, *dest;
  730. long art; {
  731.     char path[512], temp[512], ngpath[512];
  732.     long newmsg;
  733.     FILE *ifp, *ofp;
  734.     struct stat sbuf;
  735.     char *cp, *dp;
  736.     
  737.     for (cp = ng, dp = ngpath; *cp != '\0'; cp++, dp++)
  738.         if (*cp == '.')
  739.             *dp = '/';
  740.         else
  741.             *dp = *cp;
  742.     sprintf(path, "%s/%s/%ld", NEWSDIR, ngpath, art);
  743.     if (stat(path, &sbuf) < 0)
  744.         return -1;    /* likely to be common... */
  745.     sprintf(path, "%s/%s/himsg", base, dest);
  746.     if ((ifp = fopen(path, "r")) == (FILE *) 0) {
  747.         fprintf(stderr, "Conference %s: missing himsg...\n", dest);
  748.         return 2;
  749.     }
  750.     fgets(temp, sizeof temp, ifp);
  751.     fclose(ifp);
  752.     if ((newmsg = atol(temp)) < 0) {
  753.         fprintf(stderr, "Conference %s: invalid himsg...\n", dest);
  754.         return 2;
  755.     }
  756.     newmsg++;
  757.     sprintf(path, "%s/%s/%ld", NEWSDIR, ngpath, art);
  758.     if ((ifp = fopen(path, "r")) == (FILE *) 0) {
  759.         fprintf(stderr, "Are you certain that you have permission to access news?\n");
  760.         return 3;
  761.     }
  762.     sprintf(path, "%s/%s/%ld", base, dest, newmsg);
  763.     if (stat(path, &sbuf) == 0) {
  764.         fprintf(stderr, "Conference %s: corrupted (himsg incorrect)\n", dest);
  765.         fclose(ifp);
  766.         return 4;
  767.     }
  768.     if ((ofp = fopen(path, "w")) == (FILE *) 0) {
  769.         fprintf(stderr, "Conference %s: check permissions (can't create message)\n", dest);
  770.         fclose(ifp);
  771.         return 5;
  772.     }
  773.     while (fgets(temp, sizeof temp, ifp) != (char *) 0) {
  774.         fputs(temp, ofp);
  775.         if (ferror(ofp)) {
  776.             fprintf(stderr, "Write error on %s/%ld\n", dest, newmsg);
  777.             exit(5);    /* fatal! */
  778.         }
  779.     }
  780.     if (ferror(ifp)) {
  781.         fprintf(stderr, "Read error on %s/%ld\n", ng, art);
  782.         fclose(ifp);
  783.         fclose(ofp);
  784.         return 6;
  785.     }
  786.     fclose(ifp);
  787.     fclose(ofp);
  788.     sprintf(path, "%s/%s/himsg", base, dest);
  789.     if ((ifp = fopen(path, "w")) == (FILE *) 0) {
  790.         fprintf(stderr, "Conference %s: check permissions on himsg...\n", dest);
  791.         return 2;
  792.     }
  793.     fprintf(ifp, "%ld\n", newmsg);
  794.     fclose(ifp);
  795.     sprintf(path, "/tmp/uan%05d", getpid());
  796.     if ((ofp = fopen(path, "w")) == (FILE *) 0) {
  797.         fprintf(stderr, "Who moved /tmp?!\n");
  798.         return 16;
  799.     }
  800.     sprintf(path, "%s/%s/%s", base, dest, NEWSRC);
  801.     dp = "-";
  802.     if ((ifp = fopen(path, "r")) != (FILE *) 0) {
  803.         while (fgets(temp, sizeof temp, ifp) != (char *) 0) {
  804.             for (cp = temp; *cp != '\n' && *cp != ':'; cp++)
  805.                 ;
  806.             if (*cp == '\n')
  807.                 continue;    /* silent cleanup */
  808.             else
  809.                 *cp = '\0';
  810.             if (strcmp(temp, ng) == 0) {
  811.                 sprintf(temp, "%s: %ld\n", ng, art);
  812.                 dp = "#";
  813.             }
  814.             else
  815.                 *cp = ':';
  816.             fputs(temp, ofp);
  817.         }
  818.         fclose(ifp);
  819.     }
  820.     if (*dp != '#')
  821.         fprintf(ofp, "%s: %ld\n", ng, art);
  822.     fclose(ofp);
  823.     sprintf(path, "/tmp/uan%05d", getpid());
  824.     if ((ifp = fopen(path, "r")) == (FILE *) 0) {
  825.         fprintf(stderr, "Can't reopen temp file, aborting...\n");
  826.         return 16;
  827.     }
  828.     sprintf(path, "%s/%s/%s", base, dest, NEWSRC);
  829.     if ((ofp = fopen(path, "w")) == (FILE *) 0) {
  830.         fprintf(stderr, "Conference %s: can't update news link file (E:%d)\n", dest, errno);
  831.         return 17;
  832.     }
  833.     while (fgets(temp, sizeof temp, ifp) != (char *) 0)
  834.         fputs(temp, ofp);
  835.     fclose(ofp);
  836.     fclose(ifp);
  837.     sprintf(path, "/tmp/uan%05d", getpid());
  838.     unlink(path);    /* not a tragedy if this fails... */
  839.     return 0;
  840. }
  841. SHAR_EOF
  842. if test 5804 -ne "`wc -c < 'Utilities/uanews.c'`"
  843. then
  844.     echo shar: error transmitting "'Utilities/uanews.c'" '(should have been 5804 characters)'
  845. fi
  846. fi
  847. echo shar: extracting "'Utilities/udate.c'" '(317 characters)'
  848. if test -f 'Utilities/udate.c'
  849. then
  850.     echo shar: will not over-write existing file "'Utilities/udate.c'"
  851. else
  852. cat << \SHAR_EOF > 'Utilities/udate.c'
  853. /*
  854.  * %W% %E% %U% ncoast!bsa %Z%
  855.  * %Z% Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved %Z%
  856.  */
  857.  
  858. #ifndef lint
  859. static char _SccsId[] = "%W% %E% %U% ncoast!bsa %Z%";
  860. static char _CopyRt[] = "%Z% Copyright (C) 1985 by Brandon S. Allbery %Z%";
  861. #endif  lint
  862.  
  863. char *longdate();
  864.  
  865. main()
  866. {
  867.     puts(longdate());
  868. }
  869. SHAR_EOF
  870. if test 317 -ne "`wc -c < 'Utilities/udate.c'`"
  871. then
  872.     echo shar: error transmitting "'Utilities/udate.c'" '(should have been 317 characters)'
  873. fi
  874. fi
  875. echo shar: extracting "'Utilities/uwho.c'" '(2035 characters)'
  876. if test -f 'Utilities/uwho.c'
  877. then
  878.     echo shar: will not over-write existing file "'Utilities/uwho.c'"
  879. else
  880. cat << \SHAR_EOF > 'Utilities/uwho.c'
  881. /*
  882.  * %W% %E% %U% ncoast!bsa %Z%
  883.  * %Z% Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved %Z%
  884.  */
  885.  
  886. #ifndef lint
  887. static char _SccsId[] = "%W% %E% %U% ncoast!bsa %Z%";
  888. static char _CopyRt[] = "%Z% Copyright (C) 1985 by Brandon S. Allbery %Z%";
  889. #endif  lint
  890.  
  891. #include <stdio.h>
  892. #include <pwd.h>
  893.  
  894. struct passwd *getpwuid();
  895.  
  896. #ifdef SYS3
  897. #define TTYLIST "/etc/inittab"
  898. #else
  899. #define TTYLIST    "/etc/ttys"
  900. #endif
  901.  
  902. main(argc, argv)
  903. char **argv;
  904. {
  905.     FILE *tfp;
  906.     int cnt, flg;
  907.     char line[1024];
  908. #ifdef SYS3
  909.     int state;
  910.     char tty[18];
  911.     char mode[20];
  912. #endif
  913.  
  914.     if ((tfp = fopen(TTYLIST, "r")) == NULL)
  915.     {
  916.         fprintf(stderr, "%s: can't open %s\n", argv[0], TTYLIST);
  917.         exit(1);
  918.     }
  919.     flg = 0;
  920.     while (fgets(line, 1024, tfp) != NULL)
  921.     {
  922.         line[strlen(line) - 1] = '\0';    /* kill trailing newline */
  923. #ifdef SYS3
  924.         sscanf(line, "%d:%[^:]:%[^:]:", &state, tty, mode);
  925.         if (strcmp(tty, "co") == 0)
  926.             strcpy(tty, "console");
  927.         else
  928.             sprintf(tty, "tty%d", atoi(tty));    /* I hope!!! */
  929.             /* The above will be a parameter. */
  930.         if ((state != 2 && state != 7) || strchr(mode, 'o') != 0)
  931.             continue;    /* disabled tty */
  932. #else  SYS3
  933.         if (line[0] == '0')        /* disabled tty */
  934.             continue;
  935. #endif SYS3
  936.         if (argc > 1)            /* list specific ttys */
  937.         {
  938.             for (cnt = 1; cnt < argc; cnt++)
  939. #ifdef SYS3
  940.                 if (strcpy(argv[cnt], tty) == 0)
  941. #else  SYS3
  942.                     if (strcmp(argv[cnt], &line[2]) == 0)
  943. #endif SYS3
  944.                     {
  945. #ifdef SYS3
  946.                         showme(tty);
  947. #else  SYS3
  948.                         showme(&line[2]);
  949. #endif SYS3
  950.                         flg++;
  951.                     }
  952.         }
  953.         else                /* list all enabled ttys */
  954. #ifdef SYS3
  955.             showme(tty);
  956. #else  SYS3
  957.             showme(&line[2]);
  958. #endif SYS3
  959.     }
  960.     fclose(tfp);
  961.     if (argc > 1 && flg != argc - 1)
  962.     {
  963.         fprintf(stderr, "%s: bad tty name(s)\n", argv[0]);
  964.         exit(1);
  965.     }
  966.     exit(0);
  967. }
  968.  
  969. showme(ttyf)
  970. char *ttyf;
  971. {
  972.     FILE *fp;
  973.     char line[1024];
  974.  
  975.     sprintf(line, "%s/%s", getpwuid(geteuid())->pw_dir, ttyf);
  976.     if ((fp = fopen(line, "r")) == NULL)    /* not in use on this tty */
  977.         return;
  978.     fgets(line, 1024, fp);
  979.     printf("%s: %s", ttyf, line);        /* line already has newline */
  980.     fclose(fp);
  981. }
  982. SHAR_EOF
  983. if test 2035 -ne "`wc -c < 'Utilities/uwho.c'`"
  984. then
  985.     echo shar: error transmitting "'Utilities/uwho.c'" '(should have been 2035 characters)'
  986. fi
  987. fi
  988. echo shar: extracting "'Utilities/install.sh'" '(12932 characters)'
  989. if test -f 'Utilities/install.sh'
  990. then
  991.     echo shar: will not over-write existing file "'Utilities/install.sh'"
  992. else
  993. cat << \SHAR_EOF > 'Utilities/install.sh'
  994. echo ""
  995. echo "UNaXcess V0.04.03 Installation Script"
  996. echo "By Brandon S. Allbery"
  997. echo ""
  998. echo "You are free to copy, modify, etc. this installation script as much as you"
  999. echo "wish; it's bound to come in handy if anyone on your system does programming."
  1000. echo "This script should run on most Unix-based systems.  If it doesn't, PLEASE let"
  1001. echo "me know at ...decvax!cwruecmp!ncoast!allbery."
  1002. echo ""
  1003. echo "I will be asking you for information as I install UNaXcess.  When I do, I'll"
  1004. echo "let you know by ending the question with two arrows, like this:  -> ->"
  1005. echo "When I do this, it's a signal for you to tell me something.  Usually, pressing"
  1006. echo "RETURN will do something reasonable."
  1007. echo ""
  1008. :
  1009. : Note to hackers -- the original idea for this script hails from lwall@sdcrdcf
  1010. : but this script is entirely mine.  To see the original, ask anyone with rn
  1011. : sources.
  1012. :
  1013. : Yes, the "-> ->" business is copped from Unify.  I sincerely doubt that it is
  1014. : copyrighted, and it is fairly obvious.
  1015.  
  1016. if test ! -w /etc/passwd; then
  1017.     echo "I'm not running as root.  Please ask a system administrator to run this install"
  1018.     echo "script as root, as I need to create directories and possibly even a user name."
  1019.     exit 1
  1020. fi
  1021. : end of test for root.  This is about as portable as you get.
  1022.  
  1023. echo "Please enter the username of the owner of this UNaXcess system.  -> ->"
  1024. read UAOWNER
  1025. case "$UAOWNER" in
  1026. "")    echo "I hope you wanted to abort, because you just did."
  1027.     exit 1
  1028. esac
  1029. if grep "^$UAOWNER:" /etc/passwd >/dev/null 2>&1; then
  1030.     echo "I see $UAOWNER already exists.  Do you want to use him?  -> ->"
  1031.     read yesno
  1032.     case "$yesno" in
  1033.     y*|Y*)    echo "Okay, we use $UAOWNER as the owner of UNaXcess."
  1034.         ;;
  1035.     *)    echo "Then we'll start again from scratch."
  1036.         exec sh Utilities/install.sh
  1037.     esac
  1038. else
  1039.     echo "I don't see a user named $UAOWNER on this system.  Should I create one?  -> ->"
  1040.     read yesno
  1041.     case "$yesno" in
  1042.     y*|Y*)    echo "Okay, we make him."
  1043.         ;;
  1044.     *)    echo "Then we'll start again from scratch."
  1045.         exec sh Utilities/install.sh
  1046.     esac
  1047.     UAUID=`sed 's/^[^:]*:[^:]*:\([^:]*\):.*$/\1/' < /etc/passwd | sort -n | tail -1`
  1048.     UAUID=`expr $UAUID + 1`
  1049.     echo "I'm going to call $UAOWNER's home directory /usr/$UAOWNER."
  1050.     echo "If you have a better idea, please tell me what it is.  -> ->"
  1051.     read home
  1052.     case "$home" in
  1053.     "")    echo "Ok, we use /usr/$UAOWNER."
  1054.         home=/usr/$UAOWNER
  1055.     esac
  1056.     if test -r $home; then
  1057.         echo "It seems that this particular name's in use.  Let's try again."
  1058.         exec sh Utilities/install.sh
  1059.     fi
  1060.     echo "$UAOWNER::$UAUID:1:UNaXcess Control Login:$home:" >> /etc/passwd
  1061.     mkdir $home
  1062.     chown $UAOWNER $home
  1063.     echo "Now give $UAOWNER a password.  DON'T LEAVE IT UNPROTECTED!!!"
  1064.     passwd $UAOWNER
  1065. fi
  1066. echo ""
  1067. UAHOME="`sed -n '/^'$UAOWNER':/s=^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*\$=\1=p' < /etc/passwd`"
  1068. echo "UNaXcess will be installed in $UAHOME.  Is this okay?  -> ->"
  1069. read yesno
  1070. case "$yesno" in
  1071. y*|Y*)    echo "Then we'll proceed with the installation."
  1072.     ;;
  1073. *)    echo "Please check /etc/passwd for $UAOWNER's home directory, and fix it."
  1074.     echo "Then type 'sh Utilities/install.sh' to try installation again."
  1075.     exit 1
  1076. esac
  1077. chmod 711 $UAHOME
  1078. : now we know the home and owner of UNaXcess
  1079.  
  1080. if test ! -d $UAHOME/msgdir; then
  1081.     echo "Creating $UAHOME/msgdir..."
  1082.     rm -rf $UAHOME/msgdir
  1083.     mkdir $UAHOME/msgdir
  1084.     chown $UAOWNER $UAHOME/msgdir
  1085. fi
  1086. if test ! -d $UAHOME/motd; then
  1087.     echo "Creating $UAHOME/motd..."
  1088.     rm -rf $UAHOME/motd
  1089.     mkdir $UAHOME/motd
  1090.     chown $UAOWNER $UAHOME/motd
  1091. fi
  1092. if test ! -d $UAHOME/library; then
  1093.     echo "Creating $UAHOME/library..."
  1094.     rm -rf $UAHOME/library
  1095.     mkdir $UAHOME/library
  1096.     chown $UAOWNER $UAHOME/library
  1097. fi
  1098. if test ! -d $UAHOME/uploads; then
  1099.     echo "Creating $UAHOME/uploads..."
  1100.     rm -rf $UAHOME/uploads
  1101.     mkdir $UAHOME/uploads
  1102.     chown $UAOWNER $UAHOME/uploads
  1103. fi
  1104. echo "Creating $UAHOME/Logfile..."
  1105. rm -f $UAHOME/Logfile
  1106. chown $UAOWNER $UAHOME/Logfile > $UAHOME/Logfile
  1107. if test ! -f $UAHOME/userind; then
  1108.     echo "Creating $UAHOME/userind..."
  1109.     rm -rf $UAHOME/userind
  1110.     chown $UAOWNER $UAHOME/userind > $UAHOME/userind
  1111. fi
  1112. if test ! -d $UAHOME/msgdir/general; then
  1113.     echo "Creating conference general..."
  1114.     rm -rf $UAHOME/msgdir/general
  1115.     mkdir $UAHOME/msgdir/general
  1116.     chown $UAOWNER $UAHOME/msgdir/general
  1117.     echo 1 > $UAHOME/msgdir/general/himsg
  1118.     chown $UAOWNER $UAHOME/msgdir/general/himsg
  1119.     cat << --general/1-- > $UAHOME/msgdir/general/1
  1120. Date: `Utilities/udate`
  1121. From: The UNaXcess System Operator
  1122. To: All
  1123. Subject: This BBS
  1124.  
  1125. Welcome to UNaXcess V0.04.03 -- a computer bulletin board system designed for
  1126. the UNIX(tm) operating system.  You are using the ONLY BBS which is designed
  1127. to USE Unix's unique features to their fullest potential.
  1128.  
  1129. This conference is the general-purpose conference.  Use it for discussions that
  1130. don't fit in any of the existing conferences.  But if it's liable to be large,
  1131. consider making a new conference for it.
  1132.  
  1133. The basic UNaXcess commands are:
  1134.  
  1135.     r    Read messages.  You may specify a message number on the
  1136.         command line, or you will be asked how to read messages.
  1137.     
  1138.     n    Read all new messages in all conferences.
  1139.     
  1140.     e    Enter a new message.  You can specify the recipient's
  1141.         name on the command line, like "e John Doe".
  1142.     
  1143.     j    Join a different conference.  You can also create a new
  1144.         conference with this command.  You can specify the new
  1145.         conference on the command line:  "j discussion".
  1146.     
  1147.     g    Exit UNaXcess.
  1148.     
  1149.     f    Enter the File Section.  UNaXcess is capable of file
  1150.         uploading and downloading with ASCII, Xmodem and Kermit
  1151.         (not all maybe available on all systems).
  1152.  
  1153. Press BREAK (or DEL or CONTROL C, depending on the system) to stop a command.
  1154. Press CONTROL-\ (CONTROL plus backslash) for a fast logout.
  1155.  
  1156. --general/1--
  1157. fi
  1158. if test ! -d $UAHOME/msgdir/guest; then
  1159.     echo "Creating conference guest..."
  1160.     rm -rf $UAHOME/msgdir/guest
  1161.     mkdir $UAHOME/msgdir/guest
  1162.     chown $UAOWNER $UAHOME/msgdir/guest
  1163.     echo 1 > $UAHOME/msgdir/guest/himsg
  1164.     chown $UAOWNER $UAHOME/msgdir/guest/himsg
  1165.     cat << --guest/1-- > $UAHOME/msgdir/guest/1
  1166. Date: `Utilities/udate`
  1167. From: The UNaXcess System Operator
  1168. To: All
  1169. Subject: This conference
  1170.  
  1171. This conference is for any and all users of UNaXcess.  ANYONE may post messages
  1172. to the guest conference at any time.
  1173.  
  1174. --guest/1--
  1175. fi
  1176. : end of system files build, for the most part
  1177.  
  1178. echo "Where do you want the programs to go?  ENTER defaults to /bin.  -> ->"
  1179. read BIN
  1180. case "$BIN" in
  1181. "")    echo "I'll use /bin, then."
  1182.     BIN=/bin
  1183.     ;;
  1184. *)    echo "Ok, I'll put them in $BIN."
  1185.     ;;
  1186. esac
  1187. if test ! -d $BIN; then
  1188.     echo "I can't find $BIN.  Please start over after you make it."
  1189.     exit 1
  1190. fi
  1191. echo "What do you want to call UNaXcess?  ENTER defaults to ua.  -> ->"
  1192. read ua
  1193. case "$ua" in
  1194. "")    ua="ua"
  1195. esac
  1196. echo "What do you want to call the user lister?  ENTER defaults to uwho.  -> ->"
  1197. read uwho
  1198. case "$uwho" in
  1199. "")    uwho="uwho"
  1200. esac
  1201. echo "What do you want to call the date printer?  Enter defaults to udate.  -> ->"
  1202. read udate
  1203. case "$udate" in
  1204. "")    udate="udate"
  1205. esac
  1206. echo "Creating $BIN/$ua..."
  1207. cp ua $BIN/$ua
  1208. chown $UAOWNER $BIN/$ua
  1209. chmod 4711 $BIN/$ua
  1210. echo "Creating $BIN/$udate..."
  1211. cp Utilities/udate $BIN/$udate
  1212. chown $UAOWNER $BIN/$udate
  1213. chmod 711 $BIN/$udate
  1214. echo "Creating $BIN/$uwho..."
  1215. cp Utilities/uwho $BIN/$uwho
  1216. chown $UAOWNER $BIN/$uwho
  1217. chmod 4711 $BIN/$uwho
  1218. echo "Creating $UAHOME/mkconf..."
  1219. cp Utilities/mkconf $UAHOME/mkconf
  1220. chown $UAOWNER $UAHOME/mkconf
  1221. chmod 4711 $UAHOME/mkconf
  1222. : end of binary installation
  1223.  
  1224. echo "What do you want to call the shell message poster?  ENTER defaults to upost."
  1225. echo "  -> ->"
  1226. read upost
  1227. case "$upost" in
  1228. "")    upost="upost"
  1229. esac
  1230. echo "Creating $BIN/$upost..."
  1231. sed -e "s;@UAOWNER@;${UAOWNER};" -e "s;@udate@;BIN/${udate};" < Utilities/upost.sh > $BIN/$upost
  1232. chown $UAOWNER $BIN/$upost
  1233. chmod 755 $BIN/$upost
  1234. echo "What do you want to call the shell bulletin poster?  ENTER defaults to umotd."
  1235. echo "  -> ->"
  1236. read umotd
  1237. case "$umotd" in
  1238. "")    umotd="umotd"
  1239. esac
  1240. echo "Creating $BIN/$umotd..."
  1241. sed -e "s;@UAOWNER@;${UAOWNER};" -e "s;@udate@;$BIN/${udate};" < Utilities/umotd.sh > $BIN/$umotd
  1242. chown $UAOWNER $BIN/$umotd
  1243. chmod 755 $BIN/$umotd
  1244. echo "What do you want to call the message mover?  ENTER defaults to mvmsg."
  1245. echo "  -> ->"
  1246. read mvmsg
  1247. case "$mvmsg" in
  1248. "")    mvmsg="mvmsg"
  1249. esac
  1250. echo "Creating $BIN/$mvmsg..."
  1251. cp Utilities/mvmsg $BIN/$mvmsg
  1252. chown $UAOWNER $BIN/$mvmsg
  1253. chmod 4700 $BIN/$mvmsg
  1254. echo "Do you want to install the USENET News Transfer Facility?  ENTER defaults"
  1255. echo " to NO.  -> ->"
  1256. read instnews
  1257. case "$instnews" in
  1258. y*|Y*)    echo "What do you want to call the transfer program?  ENTER defaults to"
  1259.     echo "uanews.  -> ->"
  1260.     read uanews
  1261.     case "$uanews" in
  1262.     "")    uanews="uanews"
  1263.     esac
  1264.     echo "Creating $BIN/$uanews..."
  1265.     cp Utilities/uanews $BIN/$uanews
  1266.     chown $UAOWNER $BIN/$uanews
  1267.     chmod 4700 $BIN/$uanews
  1268. esac
  1269. : end of shell utilities installation
  1270.  
  1271. echo ""
  1272. echo "Now I'm going to create the runtime configuration file for UNaXcess.  This"
  1273. echo "file allows you to decide what features of UNaXcess are allowed in your BBS"
  1274. echo "system."
  1275. echo ""
  1276. echo "I suggest you read the UNaXcess README file before doing this, so you'll"
  1277. echo "know what I'm talking about."
  1278. echo ""
  1279. echo "Do you want to allow READ-ONLY conferences?  Press RETURN for YES.  -> ->"
  1280. read yesno
  1281. case "$yesno" in
  1282. ""|y*|Y*)
  1283.     readonly=YES
  1284.     ;;
  1285. *)    readonly=NO
  1286. esac
  1287. echo "Do you want to allow X-RATED (restricted) conferences?  Press RETURN for NO."
  1288. echo "  -> ->"
  1289. read yesno
  1290. case "$yesno" in
  1291. y*|Y*)
  1292.     xrated=YES
  1293.     ;;
  1294. *)    xrated=NO
  1295. esac
  1296. echo "What is the editor to be run?  The default is the internal editor.  -> ->"
  1297. read editor
  1298. case "$editor" in
  1299. "")    editor=ua-edit
  1300. esac
  1301. echo "What is the shell to be run by the COMMAND option?  The default is /bin/sh."
  1302. echo "  -> ->"
  1303. read shell
  1304. case "$shell" in
  1305. "")    shell=/bin/sh
  1306. esac
  1307. echo "Do you want to have UNaXcess check the user's shell and editor preferences"
  1308. echo "via the EDITOR and SHELL environment variables?  The default is YES.  -> ->"
  1309. read env
  1310. case "$env" in
  1311. N*|n*)    env=NO
  1312.     ;;
  1313. *)    env=YES
  1314. esac
  1315. echo "What is the login name of the user who can't log directly into UNaXcess?"
  1316. echo "RETURN if all users can log in directly  -> ->"
  1317. read bbsuser
  1318. echo "What is the time limit on UnaXcess, in minutes?  -> ->"
  1319. read tlimit
  1320. case "$tlimit" in
  1321. "")    tlimit=0
  1322. esac
  1323. echo "What is the system operator's UNaXcess login to be?  RETURN for SYSOP  -> ->"
  1324. read sysop
  1325. case "$sysop" in
  1326. "")    sysop="sysop"
  1327. esac
  1328. echo "Do you want to allow private messages?  RETURN for YES  -> ->"
  1329. read private
  1330. case "$private" in
  1331. N*|n*)    private=NO
  1332.     ;;
  1333. *)    private=YES
  1334. esac
  1335. echo "Do you want to enable logging?  RETURN for YES  -> ->"
  1336. read logging
  1337. case "$logging" in
  1338. N*|n*)    logging=NO
  1339.     ;;
  1340. *)    logging=YES
  1341. esac
  1342. echo "Please specify one of the following choices:"
  1343. echo "    nopause     Don't pause after 16 lines of output"
  1344. echo "    ask         Ask each user whether he wants puses or not"
  1345. echo "    pause       Pause after 16 lines of output always"
  1346. echo "Please select one, or press RETURN for ASK:  -> ->"
  1347. read pauses
  1348. case "$pauses" in
  1349. N*|n*)    pauses=2
  1350.     ;;
  1351. P*|p*)    pauses=0
  1352.     ;;
  1353. *)    pauses=1
  1354. esac
  1355. echo "How many tries should a user get to log in?  RETURN for 3  -> ->"
  1356. read logtries
  1357. case "$logtries" in
  1358. "")    logtries=3
  1359. esac
  1360. echo ""
  1361. echo "Creating $UAHOME/ua-config..."
  1362. cat << --CONFIG-- > $UAHOME/ua-config
  1363. readonly    $readonly
  1364. x-rated        $xrated
  1365. editor        $editor
  1366. shell        $shell
  1367. read-env    $env
  1368. bbs-user    $bbsuser
  1369. time-limit    $tlimit
  1370. sysop        "$sysop"
  1371. private-msgs    $private
  1372. logging        $logging
  1373. banner        ""
  1374. login-msg    ""
  1375. pauses        $pauses
  1376. login-tries    $logtries
  1377. --CONFIG--
  1378. chown $UAOWNER $UAHOME/ua-config
  1379. chmod 644 $UAHOME/ua-config
  1380. echo ""
  1381. echo "You can edit the config file yourself to change these and other options."
  1382. : end of config file generation
  1383.  
  1384. echo ""
  1385. echo "Creating $UAHOME/userfile..."
  1386. cat << --USERFILE-- > $UAHOME/userfile
  1387. $sysop::5::80:0
  1388. new::6::2:0
  1389. guest::1::40:0
  1390. --USERFILE--
  1391. chown $UAOWNER $UAHOME/userfile
  1392. chmod 644 $UAHOME/userfile
  1393. : end of userfile installation
  1394.  
  1395. echo ""
  1396. echo "I am going to create a simple new-user bulletin.  It is your job to change it"
  1397. echo "to say what you want it to say."
  1398. echo ""
  1399. echo "Creating $UAHOME/NewMessage..."
  1400. cat << --NEWMESSAGE-- > $UAHOME/NewMessage
  1401.  
  1402. Welcome to the UNaXcess System, Copyright (C) 1984, 1985 by Brandon S. Allbery.
  1403. This UNaXcess was installed `Utilities/udate`.
  1404.  
  1405. --NEWMESSAGE--
  1406. chown $UAOWNER $UAHOME/NewMessage
  1407. chmod 644 $UAHOME/NewMessage
  1408. : end of new user bulletin installation
  1409.  
  1410. echo "Creating $UAHOME/motd/himotd..."
  1411. echo 0 > $UAHOME/motd/himotd
  1412. chown $UAOWNER $UAHOME/motd/himotd
  1413. chmod 644 $UAHOME/motd/himotd
  1414. echo ""
  1415. echo "Now you must create the main bulletin.  I will run the $umotd program"
  1416. echo "for you -- you will simply enter the bulletin.  I hope you have EDITOR set"
  1417. echo "up correctly!"
  1418. echo ""
  1419. $BIN/$umotd
  1420. : end of bulletin installation
  1421.  
  1422. echo ""
  1423. echo "Congratulations!  You have just successfully installed the UNaXcess System."
  1424. echo "Before you use it, I suggest you put a password on the '$sysop' login,"
  1425. echo "so nobody else can make trouble with it."
  1426. echo ""
  1427. $BIN/$udate
  1428. echo "UNaXcess Version 0.04.03 (Pre-release) has been installed."
  1429. SHAR_EOF
  1430. if test 12932 -ne "`wc -c < 'Utilities/install.sh'`"
  1431. then
  1432.     echo shar: error transmitting "'Utilities/install.sh'" '(should have been 12932 characters)'
  1433. fi
  1434. fi
  1435. echo shar: extracting "'Utilities/umotd.sh'" '(551 characters)'
  1436. if test -f 'Utilities/umotd.sh'
  1437. then
  1438.     echo shar: will not over-write existing file "'Utilities/umotd.sh'"
  1439. else
  1440. cat << \SHAR_EOF > 'Utilities/umotd.sh'
  1441. :
  1442. : "%W% %E% %U% ncoast!bsa %Z%"
  1443. : "%Z% Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved %Z%"
  1444. :
  1445.  
  1446. UADIR="`sed -n 's/^@UAOWNER@:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):[^:]*$/\1/p' < /etc/passwd`"
  1447.  
  1448. msgnum=`cat $UADIR/motd/himotd`
  1449. case "$msgnum" in
  1450. [0-9]*)    ;;
  1451. *)    echo "$msgnum" >&2
  1452.     exit 1
  1453. esac
  1454. msgnum=`expr $msgnum + 1`
  1455. if echo "UNaXcess V0.04.03 (Pre-release) -- `@udate@`
  1456. " > $UADIR/motd/$msgnum 2>/dev/null
  1457. then    ${EDITOR-vi} $UADIR/motd/$msgnum
  1458.     echo $msgnum > $UADIR/motd/himotd
  1459. else    echo "$0: could not make new bulletin $msgnum"
  1460.     exit 1
  1461. fi
  1462. SHAR_EOF
  1463. if test 551 -ne "`wc -c < 'Utilities/umotd.sh'`"
  1464. then
  1465.     echo shar: error transmitting "'Utilities/umotd.sh'" '(should have been 551 characters)'
  1466. fi
  1467. fi
  1468. echo shar: extracting "'Utilities/upost.sh'" '(637 characters)'
  1469. if test -f 'Utilities/upost.sh'
  1470. then
  1471.     echo shar: will not over-write existing file "'Utilities/upost.sh'"
  1472. else
  1473. cat << \SHAR_EOF > 'Utilities/upost.sh'
  1474. :
  1475. : "%W% %E% %U% ncoast!bsa %Z%"
  1476. : "%Z% Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved %Z%"
  1477. :
  1478.  
  1479. UADIR="`sed -n 's/^@UAOWNER@:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):[^:]*$/\1/p' < /etc/passwd`"
  1480.  
  1481. conf=$1; shift
  1482. msgnum=`cat $UADIR/msgdir/$conf/himsg`
  1483. case "$msgnum" in
  1484. [0-9]*)    ;;
  1485. *)    echo "$msgnum" >&2
  1486.     exit 1
  1487. esac
  1488. msgnum=`expr $msgnum + 1`
  1489. if echo "Date: `@udate@`
  1490. From: Message Posting Daemon <${LOGNAME-daemon>
  1491. To: All
  1492. Subject: $*
  1493. " > $UADIR/msgdir/$conf/$msgnum 2>/dev/null
  1494. then    cat >> $UADIR/msgdir/$conf/$msgnum
  1495.     echo $msgnum > $UADIR/msgdir/$conf/himsg
  1496. else    echo "$0: could not make new message $msgnum in $conf"
  1497.     exit 1
  1498. fi
  1499. SHAR_EOF
  1500. if test 637 -ne "`wc -c < 'Utilities/upost.sh'`"
  1501. then
  1502.     echo shar: error transmitting "'Utilities/upost.sh'" '(should have been 637 characters)'
  1503. fi
  1504. fi
  1505. echo shar: done with directory "'Utilities'"
  1506. echo shar: extracting "'dir.h'" '(3164 characters)'
  1507. if test -f 'dir.h'
  1508. then
  1509.     echo shar: will not over-write existing file "'dir.h'"
  1510. else
  1511. cat << \SHAR_EOF > 'dir.h'
  1512. /*
  1513.  *
  1514.  *                N O T I C E
  1515.  *
  1516.  * This file is NOT a copyrighted part of the UNaXcess distribution.  These
  1517.  * are directory-reading routines which are compatible with the Berkeley Unix
  1518.  * (4.2BSD, 4.3BSD) strectory routines.  They come from the Usenet news
  1519.  * distribution and are in the public domain.
  1520.  *
  1521.  * To get the best use of them:  install the file "dir.h" in /usr/include
  1522.  * -- standard usage calls it "ndir.h", and make a random archive of dir.o and
  1523.  * put it in /usr/lib/libndir.a .  It is then available with "-lndir".
  1524.  *
  1525.  * Bell System {III, V} sites, just make an archive -- it is only one file
  1526.  * anyway.  Other sites will have to run ranlib on the archive to keep ld
  1527.  * happy.
  1528.  */
  1529.  
  1530. /*    dir.h    4.4    82/07/25    */
  1531.  
  1532. #ifdef BSD
  1533. #include <sys/dir.h>
  1534. #else
  1535.  
  1536. /*
  1537.  * A directory consists of some number of blocks of DIRBLKSIZ
  1538.  * bytes, where DIRBLKSIZ is chosen such that it can be transferred
  1539.  * to disk in a single atomic operation (e.g. 512 bytes on most machines).
  1540.  *
  1541.  * Each DIRBLKSIZ byte block contains some number of directory entry
  1542.  * structures, which are of variable length.  Each directory entry has
  1543.  * a struct direct at the front of it, containing its inode number,
  1544.  * the length of the entry, and the length of the name contained in
  1545.  * the entry.  These are followed by the name padded to a 4 byte boundary
  1546.  * with null bytes.  All names are guaranteed null terminated.
  1547.  * The maximum length of a name in a directory is MAXNAMLEN.
  1548.  *
  1549.  * The macro DIRSIZ(dp) gives the amount of space required to represent
  1550.  * a directory entry.  Free space in a directory is represented by
  1551.  * entries which have dp->d_reclen >= DIRSIZ(dp).  All DIRBLKSIZ bytes
  1552.  * in a directory block are claimed by the directory entries.  This
  1553.  * usually results in the last entry in a directory having a large
  1554.  * dp->d_reclen.  When entries are deleted from a directory, the
  1555.  * space is returned to the previous entry in the same directory
  1556.  * block by increasing its dp->d_reclen.  If the first entry of
  1557.  * a directory block is free, then its dp->d_ino is set to 0.
  1558.  * Entries other than the first in a directory do not normally have
  1559.  * dp->d_ino set to 0.
  1560.  */
  1561. #define DIRBLKSIZ    512
  1562. #define    MAXNAMLEN    255
  1563.  
  1564. struct    direct {
  1565.     long    d_ino;            /* inode number of entry */
  1566.     short    d_reclen;        /* length of this record */
  1567.     short    d_namlen;        /* length of string in d_name */
  1568.     char    d_name[MAXNAMLEN + 1];    /* name must be no longer than this */
  1569. };
  1570.  
  1571. /*
  1572.  * The DIRSIZ macro gives the minimum record length which will hold
  1573.  * the directory entry.  This requires the amount of space in struct direct
  1574.  * without the d_name field, plus enough space for the name with a terminating
  1575.  * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
  1576.  */
  1577. #ifdef DIRSIZ
  1578. #undef DIRSIZ
  1579. #endif
  1580. #define DIRSIZ(dp) \
  1581.     ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
  1582.  
  1583. #ifndef KERNEL
  1584. /*
  1585.  * Definitions for library routines operating on directories.
  1586.  */
  1587. typedef struct _dirdesc {
  1588.     int    dd_fd;
  1589.     long    dd_loc;
  1590.     long    dd_size;
  1591.     char    dd_buf[DIRBLKSIZ];
  1592. } DIR;
  1593. #ifndef NULL
  1594. #define NULL 0
  1595. #endif
  1596. extern    DIR *opendir();
  1597. extern    struct direct *readdir();
  1598. extern    closedir();
  1599. #endif KERNEL
  1600.  
  1601. #endif BSD
  1602. SHAR_EOF
  1603. if test 3164 -ne "`wc -c < 'dir.h'`"
  1604. then
  1605.     echo shar: error transmitting "'dir.h'" '(should have been 3164 characters)'
  1606. fi
  1607. fi
  1608. echo shar: extracting "'sys.h'" '(1143 characters)'
  1609. if test -f 'sys.h'
  1610. then
  1611.     echo shar: will not over-write existing file "'sys.h'"
  1612. else
  1613. cat << \SHAR_EOF > 'sys.h'
  1614. /*
  1615.  * %W% %E% %U% ncoast!bsa %Z%
  1616.  * %Z% Copyright (C) 1985 by Brandon S. Allbery, All Rights Reserved %Z%
  1617.  */
  1618.  
  1619. struct sys {
  1620.     char ua_home[50];    /* UNaXcess lives here */
  1621.     char ua_roc;    /* read-only conference flag */
  1622.     char ua_xrc;    /* x-rated conference flag */
  1623.     char ua_edit[50];    /* the default editor */
  1624.     char ua_shell[50];    /* the default shell */
  1625.     char ua_env;    /* read environment for SHELL, EDITOR */
  1626.     char ua_bbs[32];    /* name of BBS login */
  1627.     char ua_tlimit;    /* minutes until logout */
  1628.     char ua_sysop[32];    /* name of the sysop login */
  1629.     char ua_pm;    /* allow private messages? */
  1630.     char ua_log;    /* keep a log? */
  1631.     char ua_bnr[50];    /* path of banner file, EOS = internal */
  1632.     char ua_login[80];    /* login message, EOS = internal */
  1633.     char ua_hco;    /* hard-copy-output mode enable */
  1634.     char ua_nla;    /* number of attempts to login allowed */
  1635.     char ua_auc[80];    /* ascii upload command */
  1636.     char ua_adc[80];    /* ascii download command */
  1637.     char ua_xuc[80];    /* Xmodem upload command */
  1638.     char ua_xdc[80];    /* Xmodem download command */
  1639.     char ua_kuc[80];    /* Kermit upload command */
  1640.     char ua_kdc[80];    /* Kermit download command */
  1641. };
  1642.  
  1643. extern struct sys parms;
  1644. SHAR_EOF
  1645. if test 1143 -ne "`wc -c < 'sys.h'`"
  1646. then
  1647.     echo shar: error transmitting "'sys.h'" '(should have been 1143 characters)'
  1648. fi
  1649. fi
  1650. echo shar: extracting "'ua.h'" '(1446 characters)'
  1651. if test -f 'ua.h'
  1652. then
  1653.     echo shar: will not over-write existing file "'ua.h'"
  1654. else
  1655. cat << \SHAR_EOF > 'ua.h'
  1656. /*
  1657.  * %W% %E% %U% ncoast!bsa %Z%
  1658.  * %Z% Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved %Z%
  1659.  */
  1660.  
  1661. #include <stdio.h>
  1662. #include <ctype.h>
  1663. #include <setjmp.h>
  1664. #include <pwd.h>
  1665. #include <signal.h>
  1666. #include <sys/types.h>
  1667. #include <sys/stat.h>
  1668. #include <errno.h>
  1669. #include "user.h"
  1670. #include "dir.h"
  1671. #include "sys.h"
  1672.  
  1673. #ifndef SIGUSR1
  1674. #define SIGUSR1        NSIG-1
  1675. #endif
  1676.  
  1677. #define SYSOP    parms.ua_sysop
  1678. #define LOG    "Logfile"
  1679. #define MOTD    "motd"
  1680. #define PASSWD    "userfile"
  1681. #define MSGBASE    "msgdir"
  1682. #define NEWMSGS    "userind"
  1683. #define NEWUSER    "NewMessage"
  1684. #define CONFIG    "ua-config"
  1685.  
  1686. extern jmp_buf cmdloop;            /* so intrp() works */
  1687. extern int logsig(), quit(), intrp(), thatsall();
  1688. extern int doread(), doscan();
  1689. extern struct _himsg *readhigh();
  1690. extern struct tm *localtime();
  1691. extern struct passwd *getpwuid();
  1692. extern char *getowner(), *visible(), *mktemp(), *crypt(), *date(), *longdate();
  1693. extern int errno, nopause;
  1694. extern char conference[];
  1695.  
  1696. #define ToLower(x) (isupper(x)?tolower(x):x)    /* not all tolower() work */
  1697. #define ToUpper(x) (islower(x)?toupper(x):x)    /* not all toupper() work */
  1698. #define uncntrl(x) (x+'@')            /* maybe a Burroughs or CDC? */
  1699.  
  1700. #ifndef SYS3
  1701. #  define RIndex(s,c) rindex(s,c)
  1702. #  define Index(s,c) index(s,c)
  1703. extern char *rindex(), *index();
  1704. #else
  1705. #  define RIndex(s,c) strrchr(s, c)
  1706. #  define Index(s,c) strchr(s, c)
  1707. extern char *strrchr(), *strchr();
  1708. #endif
  1709.  
  1710. #ifdef BSD42
  1711. #define CONFSIZE    32
  1712. #else
  1713. #define CONFSIZE    14
  1714. #endif
  1715. SHAR_EOF
  1716. if test 1446 -ne "`wc -c < 'ua.h'`"
  1717. then
  1718.     echo shar: error transmitting "'ua.h'" '(should have been 1446 characters)'
  1719. fi
  1720. fi
  1721. echo shar: extracting "'user.h'" '(1195 characters)'
  1722. if test -f 'user.h'
  1723. then
  1724.     echo shar: will not over-write existing file "'user.h'"
  1725. else
  1726. cat << \SHAR_EOF > 'user.h'
  1727. /*
  1728.  * %W% %E% %U% ncoast!bsa %Z%
  1729.  * %Z% Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved %Z%
  1730.  */
  1731.  
  1732. struct user
  1733.     {
  1734.     char u_name[33];            /* user name */
  1735.     char u_pass[12];            /* password */
  1736.     short u_access;            /* can killmsg() or shell() ? */
  1737.     char u_login[6];            /* Intended for system login name */
  1738.     short u_llen;            /* line length, or default u_access */
  1739.     short u_nbull;            /* highest numbered bulletin read */
  1740.     char u_lconf[33];            /* login conference (dft = general) */
  1741.     }
  1742.     ;                    /* current user */
  1743.  
  1744. extern struct user user;
  1745.  
  1746. /* access modes, in u_access */
  1747.  
  1748. #define A_NONE        0        /* invalidated login */
  1749. #define A_GUEST        1        /* read-only access */
  1750. #define A_USER        2        /* standard access */
  1751. #define A_FILES        3        /* can udl() */
  1752. #define A_SYSTEM    4        /* can system() */
  1753. #define A_WITNESS    5        /* Fairwitness */
  1754. #define A_MKUSER    6        /* Special: user creator */
  1755.  
  1756. struct _himsg
  1757.     {
  1758.     char hi_conf[33];            /* conference this record refers to */
  1759.     char hi_uns;            /* unsubscribed to this conference */
  1760.     short hi_num;            /* high message in this conference */
  1761.     struct _himsg *hi_next;
  1762.     }
  1763.     ;
  1764.  
  1765. extern struct _himsg *hicnts;
  1766.  
  1767. #define HI_SUBSCR    0
  1768. #define HI_UNSUB    1
  1769. SHAR_EOF
  1770. if test 1195 -ne "`wc -c < 'user.h'`"
  1771. then
  1772.     echo shar: error transmitting "'user.h'" '(should have been 1195 characters)'
  1773. fi
  1774. fi
  1775. exit 0
  1776. #    End of shell archive
  1777.